package com.tfswx.jcyw.dmzc.service;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

@State(
        name = "dmzcXmxx",
        storages = {@Storage("dmzcXmxx.xml")}
)
@Data
public final class XmxxService implements PersistentStateComponent<XmxxService> {
    private DlxxService dlxx = DlxxService.getInstance();

    private String xmlx = "检察业务";

    // 添加走查
    private String lastKfrybm;

    // 添加评审
    private boolean psms;
    private String psjhbh;

    // 走查
    private boolean zcZjkf;
    private boolean zcZjzc;
    private boolean zcDqwj;
    private String zcSfxg;

    // 评审
    private boolean psZjkf;
    private boolean psZjzc;
    private boolean psDqwj;
    private String psSfxg;


    public XmxxService() {
        this.zcZjkf = dlxx.isZjkf();
        this.psZjkf = dlxx.isZjkf();
        this.zcZjzc = dlxx.isZjzc();
        this.psZjzc = dlxx.isZjzc();
        this.zcSfxg = null;
    }

    public static XmxxService getInstance(Project project) {
        return ServiceManager.getService(project, XmxxService.class);
    }

    @Override
    public XmxxService getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull XmxxService state) {
        XmlSerializerUtil.copyBean(state, this);
    }
}
